package org.esk.dablog.model;

import javax.persistence.*;
import java.util.Date;

/**
 * This class
 * User: jc
 * Date: 22.11.2006
 * Time: 10:41:43
 * $Id:$
 *
 * @hibernate.class table="AUTHORS"
 */
@Entity
@Table(name = "AUTHORS")
public class Author {

    private long id;
    private Date registerDate;
    private String firstName;
    private String lastName;
    private String username;
    private String password;
    private String password2;
    private String email;
    private String city;
    private String district;
    private String street;
    private String bicycle;
    private String style;
    private boolean blocked;
    private boolean hidden;


    /**
     * builds default "full name" string
     *
     * @return
     */
    @Transient
    public String getFullName() {
        return getFirstName() + " " + getLastName();
    }

    /**
     * @return
     * @hibernate.id column="ID"
     * generator-class="native"
     * @hibernate.generator-param name="sequence"
     * value="SEQ_AUTHORS"
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_AUTHORS")
    @SequenceGenerator(name = "SEQ_AUTHORS", sequenceName = "seq_authors")
    @Column(name = "ID")
    public long getId() {
        return id;
    }

    /**
     * @return
     * @hibernate.property column="FIRSTNAME"
     */
    @Column(name="FIRSTNAME")
    public String getFirstName() {
        return firstName;
    }

    /**
     * @return
     * @hibernate.property column="LASTNAME"
     */
    @Column(name="LASTNAME")
    public String getLastName() {
        return lastName;
    }

    /**
     * @return
     * @hibernate.property column="USERNAME"
     * unique="true"
     */
    @Column(name="USERNAME")
    public String getUsername() {
        return username;
    }

    /**
     * @return
     * @hibernate.property column="PASSWORD"
     */
    @Column(name="PASSWORD")
    public String getPassword() {
        return password;
    }

    /**
     * @return
     * @hibernate.property column="email"
     */
    @Column(name="EMAIL")
    public String getEmail() {
        return email;
    }

    /**
     * transient field
     *
     * @return
     */
    @Transient
    public String getPassword2() {
        return password2;
    }

    /**
     * @return
     * @hibernate.property column="city"
     */
    @Column(name="CITY")
    public String getCity() {
        return city;
    }

    /**
     * @return
     * @hibernate.property column="district"
     */
    @Column(name="DISTRICT")
    public String getDistrict() {
        return district;
    }

    /**
     * @return
     * @hibernate.property column="street"
     */
    @Column(name="STREET")
    public String getStreet() {
        return street;
    }

    /**
     * @return
     * @hibernate.property column="bike"
     */
    @Column(name="BIKE")
    public String getBicycle() {
        return bicycle;
    }

    /**
     * @return
     * @hibernate.property column="riding_style"
     */
    @Column(name="RIDING_STYLE")
    public String getStyle() {
        return style;
    }


    /**
     * @return
     * @hibernate.property column="registration_date"
     * not-null="true"
     */
    @Column(name="REGISTRATION_DATE", nullable=false)
    public Date getRegisterDate() {
        return registerDate;
    }


    /**
     * @return
     * @hibernate.property column="IS_BLOCKED"
     */
    @Column(name="IS_BLOCKED")
    public boolean isBlocked() {
        return blocked;
    }

    /**
     * @return
     * @hibernate.property column="IS_HIDDEN"
     */
    @Column(name="IS_HIDDEN")
    public boolean isHidden() {
        return hidden;
    }


    public void setBlocked(boolean blocked) {
        this.blocked = blocked;
    }

    public void setHidden(boolean hidden) {
        this.hidden = hidden;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }

    public void setPassword2(String password2) {
        this.password2 = password2;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public void setBicycle(String bicycle) {
        this.bicycle = bicycle;
    }

    public void setStyle(String style) {
        this.style = style;
    }

    public void setId(long id) {
        this.id = id;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setEmail(String email) {
        this.email = email;
    }
}
